1. Field
Embodiments of the invention relate to retrieving data objects from a data store with hierarchical relationship information based on table relationships described in a data model.
2. Description of the Related Art
A relational database stores information in different tables. In many cases, the tables contain information that is not isolated, but, instead, is relevant to information in other tables in the relational database. The relationship between various tables can be recognized through primary and foreign key definitions. To query information through multiple related tables, users can write Structured Query Language (SQL) statements that join the relevant tables to form one result set. However, the result set returned by the SQL typically returns the data in a single dimension list of values, and the hierarchical information between these tables is lost.
For instance, consider a specific example in which a relational database contains information about books. A properly normalized relational database stores the information about these books in various related tables. One table may store the book's information, such as a title, a number of pages, and an International Standard Book Number (ISBN). Another, separate table may store the information about the one or more authors of the book, and these two tables are related using primary keys and foreign keys. There may be other tables that store information about the book's publisher's information or the subject category, etc. To retrieve the full information of the book, users need to manually write a custom SQL statement that joins the relevant table. At a high level, the SQL statement may be:                Select [book information], [author information], [publisher information], from [book table], [author table], [publisher table], where [books, author, and table] refer to the same book        
Executing this type of SQL statement will return a list of rows in a result set. Each row in the result set contains the value of each column that the user included in the SQL statement. The information about the “books” may be retrieved by reading the values in each of the result set rows. However, there are two main problems with this.
The first problem is that the returned information is in one single dimension, and the inherently hierarchical information about these tables is lost. For this example, it is more natural to consider the book's main information “contains” the other related information (e.g. authors, publishers). The one dimensional list lacks a description of the relationship between the values.
The second problem is that, for tables that contain one to many relationships (e.g. a book that is written by multiple authors), the relevant information is spread across multiple rows of a table. As a particular example, say Book 1 is written by Authors A and B, and Book 2 is written by Authors C and D. Then, a user wants to retrieve the book's title, the ISBN number, and the author's first name. After executing a SQL statement, the returned information is separated across multiple rows in the result set, such as the following:    Row 1: Book 1's title, Book 1's ISBN, author A's first name, author A's last name    Row 2: Book 1's title, Book 1's ISBN, author B's first name, author B's last name    Row 3: Book 2's title, Book 2's ISBN, author C's first name, author C's last name    Row 4: Book 2's title, Book 2's ISBN, author D's first name, author D's last name
Again, the relationship of values from different tables is lost in the result set.
Thus, there is a need for a technique that retrieves data objects from a data store with hierarchical relationship information.